<cfcomponent displayname="MyComponentTest"  extends="AbstractTest">  


  <cffunction name="testFindMessageBySubject" access="public">
	  <cfscript>
			var curCount = 0;
			var randoms = randrange(1,999);
			var hits = 0;
			variables.subethaSmtpService.testmessage(delayseconds=2,subject="Randoms #randoms#");
			hits = variables.subethaSmtpService.findMessages(subject="Randoms #randoms#");
			assertEquals(1,arrayLen(hits));
		</cfscript>
	</cffunction>

  <cffunction name="testFindMessageBySender" access="public">
	  <cfscript>
			var curCount = 0;
			var randoms = randrange(1,999);
			var hits = 0;
			variables.subethaSmtpService.testmessage(delayseconds=2,subject="Randoms #randoms#",sender="wee#randoms#@randoms.com");
			hits = variables.subethaSmtpService.findMessages(sender="wee#randoms#@randoms.com");
			assertEquals(1,arrayLen(hits));
		</cfscript>
	</cffunction>

  <cffunction name="testFindMessageBySenderAndSubject" access="public">
	  <cfscript>
			var curCount = 0;
			var randoms = randrange(1,999);
			var hits = 0;
			variables.subethaSmtpService.testmessage(delayseconds=2,subject="Randoms #randoms#",sender="wee#randoms#@randoms.com");
			hits = variables.subethaSmtpService.findMessages(subject="Randoms #randoms#",sender="wee#randoms#@randoms.com");
			assertEquals(1,arrayLen(hits));
		</cfscript>
	</cffunction>

  <cffunction name="testFindDeleteMessage" access="public">
	  <cfscript>
			var curCount = 0;
			var randoms = randrange(1,999);
			var hits = 0;
			variables.subethaSmtpService.testmessage(delayseconds=2,subject="Randoms #randoms#");
			variables.subethaSmtpService.testmessage(delayseconds=2,subject="Randoms #randoms#2");
			hits = variables.subethaSmtpService.findMessages(subject="Randoms");
			debug(arraylen(hits));
			variables.subethaSmtpService.deleteFoundMessages(hits);
			hits = variables.subethaSmtpService.findMessages(subject="Randoms");
			debug(hits);
			assertEquals(0,arrayLen(hits));
		</cfscript>
	</cffunction>

</cfcomponent>
